import { ApiResult, post, get } from "@/util/request";
//用户
//根据用户名查询用户
export async function selectSysUserByUserName(
  params?: any,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysUser/selectSysUserByUserName`, params);
}

export async function selectDriverByUserNameOrgId(
  params?: any,
): Promise<ApiResult<any>> {
  return await get<any>(
    `/manage/v1/driver/selectDriverByUserNameOrgId`,
    params,
  );
}

//删除用户
export async function delSysUser(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysUser/delSysUser`, params);
}
//查询用户详情
export async function selectUserById(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysUser/selectUserById`, params);
}
//用户分页查询
export async function pageSysUser(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysUser/pageSysUser`, params);
}
//添加用户
export async function saveSysUser(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysUser/saveSysUser`, params);
}
//编辑用户
export async function updateSysUser(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysUser/updateSysUser`, params);
}

//职位
//删除职位
export async function delPosition(
  params?: any,
  id?: string,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysPosition/delPosition/${id}`, params);
}
//职位详情
export async function selectPositionById(
  params?: any,
  id?: string,
): Promise<ApiResult<any>> {
  return await get<any>(
    `/manage/v1/sysPosition/selectPositionById/${id}`,
    params,
  );
}
//根据职位名称模糊查询
export async function selectPositionByName(
  params?: any,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysPosition/selectPositionByName`, params);
}
//分页查询职位
export async function pagePosition(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysPosition/pagePosition`, params);
}
//添加职位
export async function savePosition(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysPosition/savePosition`, params);
}
//编辑职位
export async function updatePosition(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysPosition/updatePosition`, params);
}

//组织管理
//删除组织
export async function deleteOrg(
  params?: any,
  id?: string,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysOrg/delete/${id}`, params);
}
//组织详情
export async function selectOrgById(
  params?: any,
  id?: string,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysOrg/select/${id}`, params);
}
//组织树形
export async function orgTree(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysOrg/orgTree`, params);
}

//
export async function selectOrgChilds(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysOrg/selectOrgChilds`, params);
}

//组织启用组织树形
export async function orgTreeStateIsOn(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/sysOrg/orgTreeStateIsOn`, params);
}
//添加组织
export async function saveOrg(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysOrg/saveOrg`, params);
}
//编辑组织
export async function updateOrg(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysOrg/updateOrg`, params);
}
// 同步组织
export async function syncOrg(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/wework/syncOrg`, params);
}

// 同步企业微信用户
export async function syncUser(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/wework/syncUser`, params);
}
// 同步企业微信用户
export async function selectSysRoleList(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/sysRole/selectSysRoleList`, params);
}
// 用户授权角色
export async function authUserRole(params?: any): Promise<ApiResult<any>> {
  return await post<any>(`/manage/v1/auth/authUserRole`, params);
}
// 获取用户所授权角色
export async function selectRoleIdListByUserId(
  params?: any,
): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/auth/selectRoleIdListByUserId/${params}`);
}
// 重置密码
export async function resetPwd(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/login/resetPwd`, params);
}

// 用户注册统计
export async function userRegisteredTotal(params?: any): Promise<ApiResult<any>> {
  return await get<any>(`/manage/v1/total/userRegisteredTotal`, params);
}
